<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>文档管理系统 - 主页</title>
    <link rel="stylesheet" href="/css/style.css">
</head>
<body>
    <header class="main-header">
        <div class="container">
            <h1>文档管理系统</h1>
            <nav>
                <ul>
                    <li><a href="/" class="active">主页</a></li>
                    <li><a href="/login" th:if="${#authorization.expression('!isAuthenticated()')}">登录</a></li>
                    <li><a href="/register" th:if="${#authorization.expression('!isAuthenticated()')}">注册</a></li>
                    <li><a href="/dashboard" th:if="${#authorization.expression('isAuthenticated()')}">个人中心</a></li>
                    <li><a href="/logout" th:if="${#authorization.expression('isAuthenticated()')}">退出</a></li>
                </ul>
            </nav>
        </div>
    </header>

    <main class="container">
        <section class="welcome-section">
            <h2>欢迎使用文档管理系统</h2>
            <p>浏览我们的文档库，获取有价值的信息。</p>
        </section>

        <section class="documents-section">
            <h2>文档列表</h2>
            <div class="documents-grid">
                <div th:if="${documents.empty}" class="no-documents">
                    <p>暂无文档</p>
                </div>
                <div th:each="doc : ${documents}" class="document-card">
                    <h3 th:text="${doc.title}">文档标题</h3>
                    <div class="document-meta">
                        <span th:text="${#temporals.format(doc.createdAt, 'yyyy-MM-dd HH:mm')}">发布时间</span>
                    </div>
                    <p th:text="${#strings.abbreviate(doc.content, 150)}">文档内容...</p>
                    <a th:href="@{'/documents/' + ${doc.id}}" class="btn btn-primary">阅读全文</a>
                </div>
            </div>
        </section>
    </main>

    <footer class="main-footer">
        <div class="container">
            <p>&copy; 2025 文档管理系统. 保留所有权利.</p>
        </div>
    </footer>

    <script src="/js/script.js"></script>
</body>
</html> 